package com.mybrothers.controller.people;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 *  
 * @author Administrator
 *
 */
@Controller  
@RequestMapping("/teacher")  
public class TeacherController {  
	public Logger logger = LoggerFactory.getLogger(this.getClass().getName());
    
	@RequestMapping("/teacherlist")
    public String teacherList(HttpServletRequest request){
		
        logger.info("教师列表跳转");
        return "/teacher_main";  
    }
	
	@RequestMapping("/searchTeacherData")
    public void searchTeacherData(HttpServletRequest request, HttpServletResponse response){
		String json = "{\"limit\":10,\"Rows\":[{\"id\":2,\"longName\":\"admin\",\"longPassword\":\"123\",\"valid\":false},{\"id\":3,\"longName\":\"art\",\"longPassword\":\"123\",\"valid\":false}],\"start\":0,\"Total\":1}";
		logger.info("返回数据：" + json);
		
		response.setContentType("text/xml;charset=UTF-8");  
		response.setHeader("Cache-Control", "no-cache");  
		PrintWriter out = null;
		try {
			out = response.getWriter();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		out.write(json);
		out.flush();
		out.close();
    }
}